﻿//
// GNS_LoginScene.h
// MobileManageSys
//FuncTion 登录场景
// Created by mr.l on 16/1/12.
//
//

#ifndef __MobileManageSys__GNS_LoginScene__
#define __MobileManageSys__GNS_LoginScene__

#include "cocos2d.h"
#include "cocostudio/CocoStudio.h"
#include "ui/CocosGUI.h"
#include "GNS_HallScene.h"
#include "GNS_CursorTextField.h"
#include "PopWndLayer.h"
#include "GNS_YJFLayer.h"

#include "GNS_Handler.h"
#include "MyPublicMacro.h"
#include "MsgCmd.h"

USING_NS_CC;
using namespace cocostudio::timeline;
using namespace ui;
US_NS_CUSTOM_UI;

class GNS_LoginScene : public GNS_YJFLayer
{
public:
    GNS_LoginScene();
    ~GNS_LoginScene();
    static Scene* createScene();
    virtual bool init();
    CREATE_FUNC(GNS_LoginScene);
	void BtnCallBack(Ref *pSender, ui::Widget::TouchEventType type);
	void ConnectCallback();
	void SceneJump();
	void GameUpdae();
	void login();
	void LoginFile();
    PopWndLayer * OnUIAction(std::string Text,bool isUTF);
   
	bool OnHandleSocketMsg(int iClientId, int mainCmd, int subCmd, const char *msgData, int dataLen);

public:
	// 进入场景后，要初始化内容
	virtual void onEnterTransitionDidFinish();

	// 离开场景前，要释放内容
	virtual void onExitTransitionDidStart();

	// 事件桥定时器的回调函数
	void onEventBridge(float dt);

	// 连接结果
	int connectResult(int iClientId, int iSubCode, int iReconnectCount);

	// 断线重连
	int reConnectResult(int iClientId, int iSubCode, int iReconnectCount);
	void addMakerLayer();

private:
    void initData();
	bool checkInput();
    GNS_MakeLayer * pInfoMakeLayer;
    TextField * NameText;
    TextField * PassText;
    GNS_CursorTextField * InputID;
    GNS_CursorTextField * InputPass;
    PopWndLayer * pPopWnd=nullptr;
	bool flag = false;

	CustomEditBox* _NameText;
 	CustomEditBox* _PassText;
};

#endif /* defined(__MobileManageSys__GNS_LoginScene__) */